package com.cskaoyan.dbutils;

import com.cskaoyan.others.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.ColumnListHandler;

import java.sql.SQLException;
import java.util.List;

/**
 * 创建日期: 2021/11/25 16:23
 *
 * @author ciggar
 */
public class ColumnListHandlerDemo {

    public static void main(String[] args) throws SQLException {

        // 创建QueryRunner
        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        // 执行SQL语句
        List<String> nameList = queryRunner.query("select name from account where id > ?", new ColumnListHandler<String>(), 1);

        System.out.println(nameList);


    }

}
